/*


 */

package bankserver;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import java.util.Map;

/**
 *
 *
 */
public class BankServer extends UnicastRemoteObject implements Bank {
    
    private Map<String, Account> accounts = new HashMap<String, Account>();
    
    
    public BankServer() throws RemoteException {
    }
    
    public Account getAccount(String name) throws RemoteException  {    
        Account account = accounts.get(name);
        if (account == null) {
            account = new AccountServer(name);
            accounts.put(name, account);
        }
        return account;
    }

}
